package com.example.kiratest.realize.Controller;


import com.alibaba.fastjson.JSON;
import com.example.kiratest.realize.mapper.PhaTradeJsonTestMapper;
import com.example.kiratest.realize.pojo.MergeThree;
import com.example.kiratest.realize.pojo.PhaTradeTest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("phatrade")
@Slf4j
public class PhaTradeTestController {


    @Autowired
    PhaTradeJsonTestMapper phaTradeJsonTestMapper;
    @PostMapping("/testThree")
    public String testThree(@RequestBody List<MergeThree> mergeThree) {
        log.info("传输数据:{}",mergeThree);
        String jsonString = JSON.toJSONString(mergeThree);
        PhaTradeTest phaTradeTest=new PhaTradeTest();
        phaTradeTest.setJsonTest(jsonString);
        phaTradeJsonTestMapper.insertJsonTest(phaTradeTest);
        return jsonString;
    }

}
